/*
//
//              INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license  agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in  accordance  with the terms of that agreement.
//    Copyright (c) 2007 Intel Corporation. All Rights Reserved.
//
//
*/

#ifndef __UMC_AVS_SPLITTER_H
#define __UMC_AVS_SPLITTER_H

#include "umc_splitter.h"
#include "umc_media_data.h"
#include "umc_thread.h"

namespace UMC
{

// forward declaration of used classes
class MediaBuffer;

class AVSSplitter : public Splitter
{
public:
    // Default constructor
    AVSSplitter(void);
    // Destructor
    virtual
    ~AVSSplitter(void);

    // Initialize splitter
    virtual
    Status Init(SplitterParams &initParams);

    // Close splitter and free all resources
    virtual
    Status Close(void);

    virtual
    Status Run() {return UMC_OK;};

    // Stop reading media data
    virtual
    Status Stop(void) {return UMC_OK;};

    // Get next video data
    virtual
    Status GetNextData(MediaData *pDst, Ipp32u);

    // Get next audio data
    virtual
    Status GetNextAudioData(MediaData * /*pDst*/) {return UMC_ERR_NOT_IMPLEMENTED;};

    // Set position
    virtual
    Status SetPosition(Ipp64f /*fPosition*/) {return UMC_OK;}

    // Get position
    virtual
    Status GetPosition(Ipp64f &/*fPosition*/) {return UMC_OK;}

    // Get splitter info
    virtual
    Status GetInfo(SplitterInfo **pSplitterInfo);



protected:
    // Wait for first sequence header
    Status PrepareStreamInfo(void);
    // Update stream information
    Status UpdateSplitterInfo(Ipp8u *pSource, size_t srcSize);

    MediaData m_latestSample;                                   // (MediaData) latest media sample

    // working procedure for the internal thread
    static
    Ipp32u VM_THREAD_CALLCONVENTION InternalThreadRoutine(void *pvParam);

    Thread m_hThread;                                           // (Thread) the internal thread

    volatile
    bool m_bQuit;                                               // (bool) quit flag for the internal thread

    MediaBuffer *m_pVideoBuffer;                                // (MediaBuffer *) pointer to a buffer with encoded video samples
};

} // namespace UMC

#endif // __UMC_AVS_SPLITTER_H
